package com.xxxx.core.token;

import com.xiaoleilu.hutool.crypto.SecureUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


/**
 * token生成器
 *
 */
@Component
public class TokenGenerator {



    public static String TOKEN_SEED;

    @Value("${Token_Seed}")
    public void setTokenSeed(String tokenSeed) {
        TokenGenerator.TOKEN_SEED=tokenSeed;
    }
    /**
     * 生成用户登陆token
     *
     * @param text
     * @param seed
     * @return
     */
    public static String genToken(String text,String seed) {
        return SecureUtil.hmacMd5(seed.getBytes()).digestHex(text);
    }

}
